<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Array.lastIndexOf()</title>
</head>

<body>
    <h1>JavaScript Array.lastIndexOf()</h1>
    <p id="demo"></p>
    <script>
        var fruits = ["P", "A", "Q", "Z"];
        var a = fruits.lastIndexOf("A");
        document.getElementById("demo").innerHTML = "Apple is found in position " + (a + 1);
    </script>

    <p>Internet Explorer 8 或更早的版本不支持 lastIndexOf()。</p>

</body>

</html>